
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- --------------------------------------------------
-- Date Created: 01/04/2021 12:10:58
-- Generated from EDMX file: G:\VS\格太文件\ZCSBZPJ\ZP.Model\ZP_Context.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [ZPJ];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[fk_ep_cert_1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ep_cert_qualified] DROP CONSTRAINT [fk_ep_cert_1];
GO
IF OBJECT_ID(N'[dbo].[fk_ep_honor_1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ep_honor_title] DROP CONSTRAINT [fk_ep_honor_1];
GO
IF OBJECT_ID(N'[dbo].[fk_ep_ip_1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ep_ip_info] DROP CONSTRAINT [fk_ep_ip_1];
GO
IF OBJECT_ID(N'[dbo].[fk_ep_personnel_1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ep_personnel_stats] DROP CONSTRAINT [fk_ep_personnel_1];
GO
IF OBJECT_ID(N'[dbo].[fk_ep_product_1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ep_product_info] DROP CONSTRAINT [fk_ep_product_1];
GO
IF OBJECT_ID(N'[dbo].[fk_ht_tpye1_1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ht_type1_title] DROP CONSTRAINT [fk_ht_tpye1_1];
GO
IF OBJECT_ID(N'[ZPJModelStoreContainer].[fk_ht_type2_1]', 'F') IS NOT NULL
    ALTER TABLE [ZPJModelStoreContainer].[ht_type2] DROP CONSTRAINT [fk_ht_type2_1];
GO
IF OBJECT_ID(N'[ZPJModelStoreContainer].[fk_ht_type3_1]', 'F') IS NOT NULL
    ALTER TABLE [ZPJModelStoreContainer].[ht_type3] DROP CONSTRAINT [fk_ht_type3_1];
GO
IF OBJECT_ID(N'[ZPJModelStoreContainer].[fk_type1_ft_1]', 'F') IS NOT NULL
    ALTER TABLE [ZPJModelStoreContainer].[ht_type1_file] DROP CONSTRAINT [fk_type1_ft_1];
GO
IF OBJECT_ID(N'[dbo].[FK_pf_ep_basic_1]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ep_basic_data] DROP CONSTRAINT [FK_pf_ep_basic_1];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[ep_base_info]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_base_info];
GO
IF OBJECT_ID(N'[dbo].[ep_basic_data]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_basic_data];
GO
IF OBJECT_ID(N'[dbo].[ep_cert_qualified]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_cert_qualified];
GO
IF OBJECT_ID(N'[dbo].[ep_honor_title]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_honor_title];
GO
IF OBJECT_ID(N'[dbo].[ep_ip_info]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_ip_info];
GO
IF OBJECT_ID(N'[dbo].[ep_personnel_stats]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_personnel_stats];
GO
IF OBJECT_ID(N'[dbo].[ep_product_info]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_product_info];
GO
IF OBJECT_ID(N'[dbo].[ep_user_rel]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ep_user_rel];
GO
IF OBJECT_ID(N'[dbo].[fz_base_employee]', 'U') IS NOT NULL
    DROP TABLE [dbo].[fz_base_employee];
GO
IF OBJECT_ID(N'[dbo].[fz_base_param]', 'U') IS NOT NULL
    DROP TABLE [dbo].[fz_base_param];
GO
IF OBJECT_ID(N'[dbo].[fz_common_loginfo]', 'U') IS NOT NULL
    DROP TABLE [dbo].[fz_common_loginfo];
GO
IF OBJECT_ID(N'[dbo].[fz_sys_menu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[fz_sys_menu];
GO
IF OBJECT_ID(N'[dbo].[fz_sys_role]', 'U') IS NOT NULL
    DROP TABLE [dbo].[fz_sys_role];
GO
IF OBJECT_ID(N'[dbo].[fz_sys_user]', 'U') IS NOT NULL
    DROP TABLE [dbo].[fz_sys_user];
GO
IF OBJECT_ID(N'[dbo].[ht_type1_bak]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ht_type1_bak];
GO
IF OBJECT_ID(N'[dbo].[ht_type1_title]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ht_type1_title];
GO
IF OBJECT_ID(N'[ZPJModelStoreContainer].[ht_type1_file]', 'U') IS NOT NULL
    DROP TABLE [ZPJModelStoreContainer].[ht_type1_file];
GO
IF OBJECT_ID(N'[ZPJModelStoreContainer].[ht_type2]', 'U') IS NOT NULL
    DROP TABLE [ZPJModelStoreContainer].[ht_type2];
GO
IF OBJECT_ID(N'[ZPJModelStoreContainer].[ht_type3]', 'U') IS NOT NULL
    DROP TABLE [ZPJModelStoreContainer].[ht_type3];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'fz_base_param'
CREATE TABLE [dbo].[fz_base_param] (
    [id] int IDENTITY(1,1) NOT NULL,
    [name] nvarchar(255)  NOT NULL,
    [descs] nvarchar(255)  NULL,
    [state] int  NOT NULL,
    [type] nvarchar(20)  NOT NULL,
    [creater] nvarchar(255)  NULL,
    [createtime] datetime  NULL
);
GO

-- Creating table 'fz_common_loginfo'
CREATE TABLE [dbo].[fz_common_loginfo] (
    [LogIndex] int IDENTITY(1,1) NOT NULL,
    [BelongModel] nvarchar(100)  NULL,
    [BelongFunc] nvarchar(100)  NULL,
    [LogDetails] nvarchar(max)  NULL,
    [LogDate] datetime  NULL,
    [OperatorName] nvarchar(50)  NULL
);
GO

-- Creating table 'fz_sys_menu'
CREATE TABLE [dbo].[fz_sys_menu] (
    [id] int IDENTITY(1,1) NOT NULL,
    [name] nvarchar(20)  NOT NULL,
    [upId] int  NOT NULL,
    [path] nvarchar(255)  NULL,
    [isLeaf] int  NOT NULL,
    [state] int  NOT NULL,
    [updater] nvarchar(255)  NULL,
    [updatetime] datetime  NULL,
    [iconClass] nvarchar(30)  NULL,
    [type] int  NULL
);
GO

-- Creating table 'fz_sys_role'
CREATE TABLE [dbo].[fz_sys_role] (
    [id] int IDENTITY(1,1) NOT NULL,
    [name] nvarchar(255)  NOT NULL,
    [code] nvarchar(255)  NULL,
    [descs] nvarchar(255)  NULL,
    [menuIds] nvarchar(255)  NULL,
    [menuNames] nvarchar(255)  NULL,
    [state] int  NOT NULL,
    [updater] nvarchar(255)  NULL,
    [updatetime] datetime  NULL
);
GO

-- Creating table 'fz_sys_user'
CREATE TABLE [dbo].[fz_sys_user] (
    [id] int IDENTITY(1,1) NOT NULL,
    [account] nvarchar(30)  NOT NULL,
    [password] nvarchar(100)  NOT NULL,
    [roleId] int  NULL,
    [roleName] nvarchar(255)  NULL,
    [employeeId] int  NULL,
    [updater] nvarchar(255)  NULL,
    [updatetime] datetime  NULL,
    [headImg] nvarchar(max)  NULL,
    [state] int  NOT NULL,
    [isLocked] int  NULL,
    [lockTime] datetime  NULL,
    [vLink] nvarchar(200)  NULL,
    [errorTimes] int  NULL,
    [lastErrorTime] datetime  NULL
);
GO

-- Creating table 'fz_base_employee'
CREATE TABLE [dbo].[fz_base_employee] (
    [id] int IDENTITY(1,1) NOT NULL,
    [name] nvarchar(30)  NOT NULL,
    [code] nvarchar(255)  NULL,
    [idCard] nvarchar(20)  NULL,
    [mobile] nvarchar(30)  NULL,
    [sex] int  NULL,
    [birthday] datetime  NULL,
    [address] nvarchar(255)  NULL,
    [email] nvarchar(255)  NULL,
    [type] nvarchar(255)  NULL,
    [updater] nvarchar(255)  NULL,
    [updatetime] datetime  NULL,
    [state] int  NOT NULL,
    [belong] int  NOT NULL
);
GO

-- Creating table 'ep_base_info'
CREATE TABLE [dbo].[ep_base_info] (
    [ep_id] int IDENTITY(1,1) NOT NULL,
    [ep_name] varchar(100)  NULL,
    [ep_org_code] varchar(9)  NULL,
    [ep_uscn] varchar(18)  NULL,
    [ep_legal_rep] varchar(20)  NULL,
    [ep_legal_id] varchar(18)  NULL,
    [ep_reg_cap] int  NULL,
    [ep_reg_date] datetime  NULL,
    [ep_location] varchar(255)  NULL,
    [ep_area] varchar(50)  NULL,
    [ep_mailing_adr] varchar(255)  NULL,
    [ep_industry] varchar(50)  NULL,
    [ep_biz_scope] varchar(100)  NULL,
    [ep_contact] varchar(50)  NULL,
    [ep_mob] varchar(20)  NULL,
    [ep_email] varchar(50)  NULL
);
GO

-- Creating table 'ep_basic_data'
CREATE TABLE [dbo].[ep_basic_data] (
    [ep_id] int  NOT NULL,
    [data_year] smallint  NULL,
    [data_total_assets] int  NULL,
    [data_operating_income] int  NULL,
    [data_net_profit] int  NULL,
    [data_tax_actually_paid] int  NULL,
    [data_rd_spending] int  NULL,
    [data_assets_liability_ratio] smallint  NULL
);
GO

-- Creating table 'ep_cert_qualified'
CREATE TABLE [dbo].[ep_cert_qualified] (
    [ep_id] int  NOT NULL,
    [cq_iso9000] nvarchar(10)  NULL,
    [cq_iso14000] nvarchar(10)  NULL,
    [cq_iso27001] varchar(10)  NULL,
    [cq_iso20000] varchar(10)  NULL,
    [cq_cmm] varchar(10)  NULL,
    [cq_itil] varchar(10)  NULL,
    [cq_gmp] varchar(10)  NULL,
    [cq_ul] varchar(10)  NULL
);
GO

-- Creating table 'ep_honor_title'
CREATE TABLE [dbo].[ep_honor_title] (
    [ht_id] int IDENTITY(1,1) NOT NULL,
    [ht_title] nvarchar(100)  NULL,
    [ht_is] bit  NULL,
    [ht_type] tinyint  NULL,
    [ht_sort] int  NULL,
    [ep_base_info_ep_id] int  NOT NULL
);
GO

-- Creating table 'ep_ip_info'
CREATE TABLE [dbo].[ep_ip_info] (
    [ep_id] int  NOT NULL,
    [ip_new_patent] int  NULL,
    [ip_new_invention] int  NULL,
    [ip_new_utilitymodel] int  NULL,
    [ip_new_exterior] int  NULL,
    [ip_auth_patent] int  NULL,
    [ip_auth_invention] int  NULL,
    [ip_auth_utilitymodel] int  NULL,
    [ip_auth_exterior] int  NULL,
    [ip_patent_transaction] int  NULL,
    [ip_aofffrp] int  NULL,
    [ip_reg_soft] int  NULL,
    [ip_newproduct] int  NULL,
    [ip_app_software] int  NULL,
    [ip_newtech] int  NULL,
    [ip_newdevice] int  NULL,
    [ip_newformat] int  NULL,
    [ip_ldoic] int  NULL,
    [ip_tosata] int  NULL,
    [ip_patent_pledge] int  NULL,
    [ip_laopp] int  NULL,
    [ip_iurcu] int  NULL,
    [ip_coop_unit_amount_1] int  NULL,
    [ip_coop_unit_amount_2] int  NULL,
    [ip_coop_unit_amount_3] int  NULL
);
GO

-- Creating table 'ep_personnel_stats'
CREATE TABLE [dbo].[ep_personnel_stats] (
    [ep_id] int  NOT NULL,
    [per_total] int  NULL,
    [per_ss] int  NULL,
    [per_mfg] int  NULL,
    [per_rd] int  NULL,
    [per_mgt] int  NULL,
    [per_mktg] int  NULL,
    [per_other] int  NULL,
    [per_phd] int  NULL,
    [per_md] int  NULL,
    [per_ugrd] int  NULL,
    [per_sp] int  NULL,
    [per_dst] int  NULL,
    [per_iit] int  NULL,
    [per_jrt] int  NULL
);
GO

-- Creating table 'ep_product_info'
CREATE TABLE [dbo].[ep_product_info] (
    [ep_id] int  NOT NULL,
    [prod_name] nvarchar(50)  NULL,
    [prod_percent] tinyint  NULL,
    [prod_natl_rank] nvarchar(1)  NULL,
    [prod_pr_rank] nvarchar(1)  NULL,
    [prod_area] nvarchar(100)  NULL,
    [prod_have_ip] tinyint  NULL,
    [prod_type] nvarchar(50)  NULL,
    [prod_yield] nvarchar(1)  NULL,
    [prod_sales] nvarchar(1)  NULL,
    [prod_profit_tax] nvarchar(1)  NULL,
    [prod_process_flow] nvarchar(max)  NULL,
    [prod_app_field] nvarchar(max)  NULL
);
GO

-- Creating table 'ep_user_rel'
CREATE TABLE [dbo].[ep_user_rel] (
    [ep_id] int  NOT NULL,
    [user_id] int  NOT NULL,
    [is_delete] tinyint  NOT NULL
);
GO

-- Creating table 'ht_type1_bak'
CREATE TABLE [dbo].[ht_type1_bak] (
    [id] int IDENTITY(1,1) NOT NULL,
    [ep_id] int  NULL,
    [ht_id] int  NULL,
    [ft_id] int  NULL,
    [fl_name] nvarchar(200)  NULL,
    [fl_phy_add] nvarchar(500)  NULL,
    [fl_cover_time] datetime  NULL
);
GO

-- Creating table 'ht_type1_title'
CREATE TABLE [dbo].[ht_type1_title] (
    [ht_id] int  NULL,
    [ft_id] int IDENTITY(1,1) NOT NULL,
    [ft_title] nvarchar(1000)  NULL,
    [is_delete] bit  NULL
);
GO

-- Creating table 'ht_type1_file'
CREATE TABLE [dbo].[ht_type1_file] (
    [ft_id] int  NULL,
    [fl_name] nvarchar(100)  NOT NULL,
    [fl_phy_add] nvarchar(300)  NOT NULL,
    [fl_updatetime] datetime  NULL
);
GO

-- Creating table 'ht_type2'
CREATE TABLE [dbo].[ht_type2] (
    [ht_id] int  NOT NULL,
    [t2_name] nvarchar(200)  NULL,
    [t2_content] nvarchar(500)  NULL
);
GO

-- Creating table 'ht_type3'
CREATE TABLE [dbo].[ht_type3] (
    [ht_id] int  NOT NULL,
    [t3_name] nvarchar(200)  NULL,
    [t3_count] int  NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [id] in table 'fz_base_param'
ALTER TABLE [dbo].[fz_base_param]
ADD CONSTRAINT [PK_fz_base_param]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [LogIndex] in table 'fz_common_loginfo'
ALTER TABLE [dbo].[fz_common_loginfo]
ADD CONSTRAINT [PK_fz_common_loginfo]
    PRIMARY KEY CLUSTERED ([LogIndex] ASC);
GO

-- Creating primary key on [id] in table 'fz_sys_menu'
ALTER TABLE [dbo].[fz_sys_menu]
ADD CONSTRAINT [PK_fz_sys_menu]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'fz_sys_role'
ALTER TABLE [dbo].[fz_sys_role]
ADD CONSTRAINT [PK_fz_sys_role]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'fz_sys_user'
ALTER TABLE [dbo].[fz_sys_user]
ADD CONSTRAINT [PK_fz_sys_user]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'fz_base_employee'
ALTER TABLE [dbo].[fz_base_employee]
ADD CONSTRAINT [PK_fz_base_employee]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [ep_id] in table 'ep_base_info'
ALTER TABLE [dbo].[ep_base_info]
ADD CONSTRAINT [PK_ep_base_info]
    PRIMARY KEY CLUSTERED ([ep_id] ASC);
GO

-- Creating primary key on [ep_id] in table 'ep_basic_data'
ALTER TABLE [dbo].[ep_basic_data]
ADD CONSTRAINT [PK_ep_basic_data]
    PRIMARY KEY CLUSTERED ([ep_id] ASC);
GO

-- Creating primary key on [ep_id] in table 'ep_cert_qualified'
ALTER TABLE [dbo].[ep_cert_qualified]
ADD CONSTRAINT [PK_ep_cert_qualified]
    PRIMARY KEY CLUSTERED ([ep_id] ASC);
GO

-- Creating primary key on [ht_id] in table 'ep_honor_title'
ALTER TABLE [dbo].[ep_honor_title]
ADD CONSTRAINT [PK_ep_honor_title]
    PRIMARY KEY CLUSTERED ([ht_id] ASC);
GO

-- Creating primary key on [ep_id] in table 'ep_ip_info'
ALTER TABLE [dbo].[ep_ip_info]
ADD CONSTRAINT [PK_ep_ip_info]
    PRIMARY KEY CLUSTERED ([ep_id] ASC);
GO

-- Creating primary key on [ep_id] in table 'ep_personnel_stats'
ALTER TABLE [dbo].[ep_personnel_stats]
ADD CONSTRAINT [PK_ep_personnel_stats]
    PRIMARY KEY CLUSTERED ([ep_id] ASC);
GO

-- Creating primary key on [ep_id] in table 'ep_product_info'
ALTER TABLE [dbo].[ep_product_info]
ADD CONSTRAINT [PK_ep_product_info]
    PRIMARY KEY CLUSTERED ([ep_id] ASC);
GO

-- Creating primary key on [ep_id] in table 'ep_user_rel'
ALTER TABLE [dbo].[ep_user_rel]
ADD CONSTRAINT [PK_ep_user_rel]
    PRIMARY KEY CLUSTERED ([ep_id] ASC);
GO

-- Creating primary key on [id] in table 'ht_type1_bak'
ALTER TABLE [dbo].[ht_type1_bak]
ADD CONSTRAINT [PK_ht_type1_bak]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [ft_id] in table 'ht_type1_title'
ALTER TABLE [dbo].[ht_type1_title]
ADD CONSTRAINT [PK_ht_type1_title]
    PRIMARY KEY CLUSTERED ([ft_id] ASC);
GO

-- Creating primary key on [fl_name], [fl_phy_add] in table 'ht_type1_file'
ALTER TABLE [dbo].[ht_type1_file]
ADD CONSTRAINT [PK_ht_type1_file]
    PRIMARY KEY CLUSTERED ([fl_name], [fl_phy_add] ASC);
GO

-- Creating primary key on [ht_id] in table 'ht_type2'
ALTER TABLE [dbo].[ht_type2]
ADD CONSTRAINT [PK_ht_type2]
    PRIMARY KEY CLUSTERED ([ht_id] ASC);
GO

-- Creating primary key on [ht_id] in table 'ht_type3'
ALTER TABLE [dbo].[ht_type3]
ADD CONSTRAINT [PK_ht_type3]
    PRIMARY KEY CLUSTERED ([ht_id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [ep_id] in table 'ep_cert_qualified'
ALTER TABLE [dbo].[ep_cert_qualified]
ADD CONSTRAINT [fk_ep_cert_1]
    FOREIGN KEY ([ep_id])
    REFERENCES [dbo].[ep_base_info]
        ([ep_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ep_base_info_ep_id] in table 'ep_honor_title'
ALTER TABLE [dbo].[ep_honor_title]
ADD CONSTRAINT [fk_ep_honor_1]
    FOREIGN KEY ([ep_base_info_ep_id])
    REFERENCES [dbo].[ep_base_info]
        ([ep_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'fk_ep_honor_1'
CREATE INDEX [IX_fk_ep_honor_1]
ON [dbo].[ep_honor_title]
    ([ep_base_info_ep_id]);
GO

-- Creating foreign key on [ep_id] in table 'ep_ip_info'
ALTER TABLE [dbo].[ep_ip_info]
ADD CONSTRAINT [fk_ep_ip_1]
    FOREIGN KEY ([ep_id])
    REFERENCES [dbo].[ep_base_info]
        ([ep_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ep_id] in table 'ep_personnel_stats'
ALTER TABLE [dbo].[ep_personnel_stats]
ADD CONSTRAINT [fk_ep_personnel_1]
    FOREIGN KEY ([ep_id])
    REFERENCES [dbo].[ep_base_info]
        ([ep_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ep_id] in table 'ep_product_info'
ALTER TABLE [dbo].[ep_product_info]
ADD CONSTRAINT [fk_ep_product_1]
    FOREIGN KEY ([ep_id])
    REFERENCES [dbo].[ep_base_info]
        ([ep_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ep_id] in table 'ep_basic_data'
ALTER TABLE [dbo].[ep_basic_data]
ADD CONSTRAINT [FK_pf_ep_basic_1]
    FOREIGN KEY ([ep_id])
    REFERENCES [dbo].[ep_base_info]
        ([ep_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ht_id] in table 'ht_type1_title'
ALTER TABLE [dbo].[ht_type1_title]
ADD CONSTRAINT [fk_ht_tpye1_1]
    FOREIGN KEY ([ht_id])
    REFERENCES [dbo].[ep_honor_title]
        ([ht_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'fk_ht_tpye1_1'
CREATE INDEX [IX_fk_ht_tpye1_1]
ON [dbo].[ht_type1_title]
    ([ht_id]);
GO

-- Creating foreign key on [ht_id] in table 'ht_type2'
ALTER TABLE [dbo].[ht_type2]
ADD CONSTRAINT [fk_ht_type2_1]
    FOREIGN KEY ([ht_id])
    REFERENCES [dbo].[ep_honor_title]
        ([ht_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ht_id] in table 'ht_type3'
ALTER TABLE [dbo].[ht_type3]
ADD CONSTRAINT [fk_ht_type3_1]
    FOREIGN KEY ([ht_id])
    REFERENCES [dbo].[ep_honor_title]
        ([ht_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ft_id] in table 'ht_type1_file'
ALTER TABLE [dbo].[ht_type1_file]
ADD CONSTRAINT [fk_type1_ft_1]
    FOREIGN KEY ([ft_id])
    REFERENCES [dbo].[ht_type1_title]
        ([ft_id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'fk_type1_ft_1'
CREATE INDEX [IX_fk_type1_ft_1]
ON [dbo].[ht_type1_file]
    ([ft_id]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------